<% @title = resource.human %>
<h1><%= @title %></h1>


<% if records.present? %>
  <div class="paginator"></div>

  <%= render :layout => 'grid' do |record| %>
    <%= link_to 'show', resource.member_path(record), :data => {'new-dialog-uri' => resource.member_path(record)} if configuration.show %>
    <%= link_to 'edit', resource.edit_path(record) if update_fields.present? %>
    <% _members.each do |member| %>
      <%= link_to member.label, resource.member_path(record, :action => member.action) if member.display? %>
    <% end %>
    <%= link_to 'destroy', resource.member_path(record), :confirm => "Are you sure?", :method => :delete if configuration.destroy %>
  <% end %>

  <div class="paginator"></div>

  <%= javascript_tag do %>
    $$('.paginator').each(function(element) {
      new Paginator({total: <%= records.num_pages %>, current: <%= params[:page] || 1 %>, link: {'href': '<%= resource.collection_path(:page => '%{page}', Puffer::Filters.model_name.param_key => puffer_filters.query).html_safe %>'}}).insertTo(element, 'instead');
    });
  <% end %>
<% else %>
  <p>Sorry, but there is no records in <%= resource.human %></p>
<% end %>
